package bean;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;


@Entity
@Table(name="professor")
public class Professor {

	@Id
	private int matricula;
	
	@Column(nullable = false, length= 100)
	private String nome;
	
	@Column
	private String carga_horaria;
	
	@Column
	private String formacao;
	
	@ManyToMany(mappedBy = "professores")
	private List<Disciplina> disciplinas;
	
	
	public int getMatricula() {
		return matricula;
	}
	public void setMatricula(int matricula) {
		this.matricula = matricula;
	}
	public String getNome() {
		return nome;
	}
	public void setNome(String nome) {
		this.nome = nome;
	}
	public String getCarga_horaria() {
		return carga_horaria;
	}
	public void setCarga_horaria(String carga_horaria) {
		this.carga_horaria = carga_horaria;
	}
	public String getFormacao() {
		return formacao;
	}
	public void setFormacao(String formacao) {
		this.formacao = formacao;
	}
	
	@Override
	public boolean equals(Object obj) {
		if(obj instanceof Professor){
			Professor p = (Professor) obj;
			if(p.getMatricula() == this.getMatricula()){
				return true;
			}
		}
		return false;
	}
}
